/*
 * 文件名： BoundPhoneActivity.java
 * 描    述：联系人信息
 * 时    间：2015-3-25 下午5:47:21
 * 版    本：V1.0
 */
package com.miguo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.miguo.activity.base.BaseActivity;
import com.miguo.app.AppContext;
import com.miguo.component.BaseHeadView;
import com.miguo.ui.R;

public class AcceptAddressActivity extends BaseActivity {

    private BaseHeadView mBaseHead;
    private TextView mEtName, mEtPhone, mEtYouBian, mEtArea, mEtScreet;
    private final int REQUEST_CODE = 1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_accept_address);
        findViewById();
        initView();
    }

    private void findViewById() {

        // 姓名
        mEtName = (TextView) findViewById(R.id.acceptAddress_name);
        // 电话
        mEtPhone = (TextView) findViewById(R.id.acceptAddress_phone);
        // 邮编
        mEtYouBian = (TextView) findViewById(R.id.acceptAddress_youBian);
        // 省市区
        mEtArea = (TextView) findViewById(R.id.acceptAddress_area);
        // 街道地址
        mEtScreet = (TextView) findViewById(R.id.acceptAddress_street);
        // 修改
        findViewById(R.id.acceptAddress_btn).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivityForResult(new Intent(mActivity,
                        AcceptAddressChangeActivity.class), REQUEST_CODE);
            }
        });
    }

    private void initView() {
        mBaseHead = (BaseHeadView) findViewById(R.id.base_head);
        mBaseHead.setActivity(this);
        mBaseHead.setTitle("收货信息");

        mEtName.setText(AppContext.UserInfo().getTruename());
        mEtPhone.setText(AppContext.UserInfo().getTelePhone());
        mEtYouBian.setText(AppContext.UserInfo().getPostcode());
        mEtArea.setText(AppContext.UserInfo().getArea());
        mEtScreet.setText(AppContext.UserInfo().getAddress());
    }

    @Override
    protected void onActivityResult(int request, int arg1, Intent arg2) {
        if (request == REQUEST_CODE && arg1 == RESULT_OK) {
            initView();
        }
    }

}
